from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet

from goods.models import SPUSpecification, SPU
from meiduo_admin.serializers.specs import SpecsSerialzier, SPUSerializer
from meiduo_admin.serializers.user import PageNum


class Specsview(ModelViewSet):
    serializer_class = SpecsSerialzier
    queryset = SPUSpecification.objects.all()
    pagination_class = PageNum

    def simple(self,request):

        spus = SPU.objects.all()
        ser = SPUSerializer(spus,many=True)
        return Response(ser.data)
